package com.clk.clksense;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class CLKSensE extends Activity {
	protected static final int SECURITY_REQUEST_CODE = 100;
	protected static final int SETTINGS_REQUEST_CODE = 101;
	private EditText txtUserID;
	private EditText txtPass;

	// ----------------------------------------------------------------------------------
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_clksens_e);
		txtUserID = (EditText) findViewById(R.id.txtUserID);
		txtPass = (EditText) findViewById(R.id.txtPass);
	}

	// ----------------------------------------------------------------------------------
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_clksens_e, menu);
		return true;
	}

	// ----------------------------------------------------------------------------------
	public void loginClick(View view) {
		Toast.makeText(CLKSensE.this, "Login Successful", Toast.LENGTH_LONG).show();
		txtUserID.setText("");
		txtPass.setText("");
		Intent i = new Intent(CLKSensE.this, Security.class);
		startActivityForResult(i, SECURITY_REQUEST_CODE);
	}

	// ----------------------------------------------------------------------------------
	public void settingsClick(View view) {
		Intent i = new Intent(CLKSensE.this, Settings.class);
		startActivityForResult(i, SETTINGS_REQUEST_CODE);
	}

	// ----------------------------------------------------------------------------------
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		if (requestCode == SECURITY_REQUEST_CODE) {
			Bundle b = data.getExtras();
			txtUserID.setText(b.getString("TEXT"));
		}
	}
	// ----------------------------------------------------------------------------------
}
